# !! pip install toml
import toml
    
class SyncConfig:
    def __init__(self, homedir, syncdir, listed_dirs) -> None:
        self.homedir = homedir
        self.syncdir = syncdir
        self.listed_dirs = listed_dirs
    

def read_cfg_toml(file):
    return toml.load(file)

def get_cfg(d: dict) -> SyncConfig:
    return SyncConfig(
        d["homedir"],
        d["syncdir"],
        d["dirlist"]
    )

def get_config(filepath):
    return get_cfg(read_cfg_toml(filepath))